package utils;

import java.util.List;

/**
 * 分页工具类
 * @param <T>
 */
public class Page<T> {
    private int totalCount;         //记录总数
    private int totalPageCount ;    //总页数
    private int pageSize = Constants.PAGE_SIZE;            //每页展示记录数
    private int currPageNo ;          //当前页码
    private List<T> list;        //每页数据集合

    public int getTotalPageCount() {
        return totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        if (totalCount>0){
            this.totalCount = totalCount;
            //求总页数
            this.totalPageCount = (totalCount%pageSize)==0 ? (totalCount/pageSize) :((totalCount/pageSize)+1);
        }

    }

    public int getCurrPageNo() {
        return currPageNo;
    }

    public void setCurrPageNo(int currPageNo) {
        this.currPageNo = currPageNo;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
